Skip to content

Conversation

@tigh-latte
Copy link

Add a Range function for ordered traversal.

I know that #8 is already opened and adds an iterator, however, this solution is both simplified and conforms to a pattern already in Golang, sync.Map.Range.

Usage:

om.Range(func(k string, v interface{}) bool {
	fmt.Printf("key=%s, val=%v\n", k, v)
	return true
})

If a user wants to break, then they can just return false from the passed function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant